package com.example.spring.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @功能
 * @作者 沈飞超
 * @日期 2020年08月29日 5:48
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Car implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    private String name;

    private Integer age;

    public Car(String name, Integer age) {
        this.name = name;
        this.age = age;
    }

    public void init() {
        System.out.println("init。。。");
    }

    public void destroy() {
        System.out.println("destroy。。。");
    }


    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
